﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using VOL.Core.Utilities;
using VOL.Domain.IServices;
using VOL.Domain.IServices.MasterData;

namespace VOL.WebApi.Controllers.MasterData
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class MaterialCatalogController : ControllerBase
    {
        private readonly IMaterialCatalogService _materialCatalogService;

        public MaterialCatalogController(IMaterialCatalogService materialCatalogService)
        {
            _materialCatalogService = materialCatalogService;
        }

        /// <summary>
        /// 获取物料分类树状结构
        /// </summary>
        /// <returns>返回树状结构的物料分类数据</returns>
        [HttpGet]
        public async Task<WebResponseContent> GetMaterialCatalog()
        {
            return await _materialCatalogService.GetMaterialCatalog();
        }
    }
}
